package com.huluobo.a2308douyindemo.register

import androidx.lifecycle.MutableLiveData
import com.huluobo.a2308douyindemo.bean.UserBean
import com.huluobo.a2308douyindemo.mvvm.BaseViewModel
import com.huluobo.a2308douyindemo.net.ApiService
import com.huluobo.a2308douyindemo.net.Res
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 *  Created by LC on 2025/10/17.
 */
@HiltViewModel
class RegisterViewModel @Inject constructor(private val apiService: ApiService) : BaseViewModel() {
    val registerSuccess by lazy { MutableLiveData<Res<UserBean>>() }
    fun register(username: String, password: String) {
        executeNetwork(
            { apiService.register(username, password) },
            registerSuccess::postValue
        )
    }
}